package com.tensquare.article.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.tensquare.article.pojo.Article;
import org.springframework.data.jpa.repository.Query;

/**
 * 数据访问接口
 * @author Administrator
 *
 */
public interface ArticleRepository extends JpaRepository<Article,String>,JpaSpecificationExecutor<Article>{

    /** 
    * @Description: 文章审核
    * @Param: [id] 
    * @return: void 
    * @Author: NieMiao 
    * @Date: 2018/12/24 
    */ 
    @Query(value = "update Article set state = '1' where id = ?1",nativeQuery = true)
    public void examine(String id);
    
    /** 
    * @Description: 给文章点赞，增加点赞数
    * @Param: [id] 
    * @return: void 
    * @Author: NieMiao 
    * @Date: 2018/12/24 
    */ 
    @Query(value ="update Article set thumbup = thumbup+1 where id = ?1",nativeQuery = true)
    public void updateThumbup(String id);
}
